# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AndroidManagement.V1.Model.Command do
  @moduledoc """
  A command.

  ## Attributes

  *   `clearAppsDataParams` (*type:* `GoogleApi.AndroidManagement.V1.Model.ClearAppsDataParams.t`, *default:* `nil`) - Parameters for the CLEAR_APP_DATA command to clear the data of specified apps from the device. See ClearAppsDataParams. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to CLEAR_APP_DATA. It is also acceptable to explicitly set type to CLEAR_APP_DATA.
  *   `clearAppsDataStatus` (*type:* `GoogleApi.AndroidManagement.V1.Model.ClearAppsDataStatus.t`, *default:* `nil`) - Output only. Status of the CLEAR_APP_DATA command to clear the data of specified apps from the device. See ClearAppsDataStatus.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - The timestamp at which the command was created. The timestamp is automatically generated by the server.
  *   `duration` (*type:* `String.t`, *default:* `nil`) - The duration for which the command is valid. The command will expire if not executed by the device during this time. The default duration if unspecified is ten minutes. There is no maximum duration.
  *   `errorCode` (*type:* `String.t`, *default:* `nil`) - If the command failed, an error code explaining the failure. This is not set when the command is cancelled by the caller.
  *   `newPassword` (*type:* `String.t`, *default:* `nil`) - For commands of type RESET_PASSWORD, optionally specifies the new password. Note: The new password must be at least 6 characters long if it is numeric in case of Android 14 devices. Else the command will fail with INVALID_VALUE.
  *   `resetPasswordFlags` (*type:* `list(String.t)`, *default:* `nil`) - For commands of type RESET_PASSWORD, optionally specifies flags.
  *   `startLostModeParams` (*type:* `GoogleApi.AndroidManagement.V1.Model.StartLostModeParams.t`, *default:* `nil`) - Parameters for the START_LOST_MODE command to put the device into lost mode. See StartLostModeParams. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to START_LOST_MODE. It is also acceptable to explicitly set type to START_LOST_MODE.
  *   `startLostModeStatus` (*type:* `GoogleApi.AndroidManagement.V1.Model.StartLostModeStatus.t`, *default:* `nil`) - Output only. Status of the START_LOST_MODE command to put the device into lost mode. See StartLostModeStatus.
  *   `stopLostModeParams` (*type:* `GoogleApi.AndroidManagement.V1.Model.StopLostModeParams.t`, *default:* `nil`) - Parameters for the STOP_LOST_MODE command to take the device out of lost mode. See StopLostModeParams. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to STOP_LOST_MODE. It is also acceptable to explicitly set type to STOP_LOST_MODE.
  *   `stopLostModeStatus` (*type:* `GoogleApi.AndroidManagement.V1.Model.StopLostModeStatus.t`, *default:* `nil`) - Output only. Status of the STOP_LOST_MODE command to take the device out of lost mode. See StopLostModeStatus.
  *   `type` (*type:* `String.t`, *default:* `nil`) - The type of the command.
  *   `userName` (*type:* `String.t`, *default:* `nil`) - The resource name of the user that owns the device in the form enterprises/{enterpriseId}/users/{userId}. This is automatically generated by the server based on the device the command is sent to.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :clearAppsDataParams =>
            GoogleApi.AndroidManagement.V1.Model.ClearAppsDataParams.t() | nil,
          :clearAppsDataStatus =>
            GoogleApi.AndroidManagement.V1.Model.ClearAppsDataStatus.t() | nil,
          :createTime => DateTime.t() | nil,
          :duration => String.t() | nil,
          :errorCode => String.t() | nil,
          :newPassword => String.t() | nil,
          :resetPasswordFlags => list(String.t()) | nil,
          :startLostModeParams =>
            GoogleApi.AndroidManagement.V1.Model.StartLostModeParams.t() | nil,
          :startLostModeStatus =>
            GoogleApi.AndroidManagement.V1.Model.StartLostModeStatus.t() | nil,
          :stopLostModeParams =>
            GoogleApi.AndroidManagement.V1.Model.StopLostModeParams.t() | nil,
          :stopLostModeStatus =>
            GoogleApi.AndroidManagement.V1.Model.StopLostModeStatus.t() | nil,
          :type => String.t() | nil,
          :userName => String.t() | nil
        }

  field(:clearAppsDataParams, as: GoogleApi.AndroidManagement.V1.Model.ClearAppsDataParams)
  field(:clearAppsDataStatus, as: GoogleApi.AndroidManagement.V1.Model.ClearAppsDataStatus)
  field(:createTime, as: DateTime)
  field(:duration)
  field(:errorCode)
  field(:newPassword)
  field(:resetPasswordFlags, type: :list)
  field(:startLostModeParams, as: GoogleApi.AndroidManagement.V1.Model.StartLostModeParams)
  field(:startLostModeStatus, as: GoogleApi.AndroidManagement.V1.Model.StartLostModeStatus)
  field(:stopLostModeParams, as: GoogleApi.AndroidManagement.V1.Model.StopLostModeParams)
  field(:stopLostModeStatus, as: GoogleApi.AndroidManagement.V1.Model.StopLostModeStatus)
  field(:type)
  field(:userName)
end

defimpl Poison.Decoder, for: GoogleApi.AndroidManagement.V1.Model.Command do
  def decode(value, options) do
    GoogleApi.AndroidManagement.V1.Model.Command.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AndroidManagement.V1.Model.Command do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
